<?php
/**
 * Created by PhpStorm.
 * User: sen
 * Date: 16/7/13
 * Time: 下午4:18
 */
namespace app\controllers;
use yii\web\Controller;
use app\models\Globals;


class ShopController extends Controller{


    //加载view
    public function actionIndex(){
        $view = \Yii::$app->view;
        $view->params['menuitemid']=11;

        $model=Globals::find()->where(['key'=>'shop_name'])->one();
        return $this->render('index',['model' => $model]);
    }


    //更新店名
    public function actionUpdateShopName(){
        //获取相应字段
        $request = \Yii::$app->request;
        $shop_name = $request->get('shop_name');
        $shop = Globals::findOne(['key' => 'shop_name']);
        $shop->value = $shop_name;
        $rs=$shop->save();
        echo json_encode($rs);
    }


}